<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>蔬菜小冷库货物入库</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/cold-storage.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
</head>
<body>
<%
String code = request.getParameter("code");
String state =request.getParameter("state");
%>
<div class="viewport">
    <%@ include file='../cold-header.html'%>
    <div class="content m-top">
        <div class="csi-1">
            <div class="csi-1-1"><span id="sj" style="float:right;font-size:12px;"></span></div>
            <script type="text/javascript">
                /*时间*/
                function getNowFormatDate() {
                    var date = new Date();
                    var seperator1 = "-";
                    var seperator2 = ":";
                    var month = date.getMonth() + 1;
                    var strDate = date.getDate();
                    if (month >= 1 && month <= 9) {
                        month = "0" + month;
                    }
                    if (strDate >= 0 && strDate <= 9) {
                        strDate = "0" + strDate;
                    }

                    var hours = date.getHours()>9?date.getHours():("0"+date.getHours());
                    var minutes = date.getMinutes()>9?date.getMinutes():("0"+date.getMinutes());
                    var seconds = date.getSeconds()>9?date.getSeconds():("0"+date.getSeconds());
                    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                            + " " + hours + seperator2 + minutes
                            + seperator2 + seconds;
                    sj.innerHTML=currentdate;
                }
                setInterval("getNowFormatDate()",0);
            </script>
            <div class="blank-z"></div>
            <div class="csi-2" style="font-size:12px;">
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:75px;">入库单编号：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-1" style="border:none;width: 70%;background-color: transparent;height:26px;"><a href="javascript:void(0)" class="sure" id="sure">查 询</a></td>
                        </tr>
                    </table>
                </div>
                <div class="blank-m"></div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:70px;">货主姓名：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-2" readonly="readonly" style="border:none;width: 80%;background-color: transparent;height:26px;"></td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:70px;">货主电话：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-3" readonly="readonly" style="border:none;width: 80%;background-color: transparent;height:26px;"></td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:85px;">蔬菜包装方式：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-4" readonly="readonly"  style="border:none;width: 80%;background-color: transparent;height:26px;"></td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:85px;">每日收费标准：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-5" readonly="readonly"  style="border:none;width: 85%;background-color: transparent;height:26px;text-align:right;">元/件</td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:85px;">蔬菜入库件数：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-6" readonly="readonly"  style="border:none;width: 85%;background-color: transparent;height:26px;text-align:right;">件</td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:70px;">剩余件数：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-7" readonly="readonly"  style="border:none;width: 85%;background-color: transparent;height:26px;text-align:right;">件</td>
                        </tr>
                    </table>
                </div>
                <div class="csi-2-1">
                    <table style="width:100%;">
                        <tr>
                            <td style="width:70px;">已交金额：</td>
                            <td style="border-bottom: 1px solid #ccc;"><input type="text" autocomplete="off" name="" id="cs-8" readonly="readonly"  style="border:none;width: 85%;background-color: transparent;height:26px;text-align:right;">元</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    $(function(){
        $("#sure").click(function(){
        	var cs = $("#cs-1").val();
        	if(cs == ""){
        		layer.msg("请输入入库编号",{shadeClose:true,shade:0.1,time:2000});
        	}
        	else{
        		layer.load();
                $.ajax({
                    type:"post",
                    url:"/wape-web/api/core/centerService",
                    data:{
                        serviceCode:""
                    },
                    success:function(data){
                        var sure = eval("("+data+")");
                        if(sure.returnCode = "200"){
                            layer.closeAll();
                            $("#cs-2").val();
                            $("#cs-3").val();
                            $("#cs-4").val();
                            $("#cs-5").val();
                            $("#cs-6").val();
                            $("#cs-7").val();
                            $("#cs-8").val();
                        }
                        else{
                            layer.closeAll();
                            layer.msg("查询失败!",{shadeClose:true,shade:0.1,time:2000});
                        }
                    }
                });
        	}
        });
    });
    /*识别浏览器*/
    $(function(){
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == 'micromessenger'){
            /*微信自动登录 */
            //layer.load();
            $.ajax({
                url:"/wape-web/api/core/centerService",
                dataType:"json",
                data:{
                    serviceCode:"1001W01",
                    code:"<%=code %>"
                },
                complete:function(xhr,status){
                	var openId = xhr.responseText.replace(/(\n)+|(\r\n)+/g, "");
                    //alert(openId);
                	if(openId == "null" || openId == ""){
                        layer.closeAll();
                        window.location.href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=cold-storage-inquire&prefix=3g_cold-storage_operate&entrance=yes";
                    }
                    else{
                    	$.ajax({
                            type:"post",
                            url:"/wape-web/api/core/centerService",
                            data:{
                                serviceCode:"1001W02",
                                sign: 'web',
                                timestamp: 'web',
                                nonce: 'web',
                                editUser: 'web',
                                editTime: 'web',
                                device: 'web',
                                ipaddr: 'web',
                                mac: 'web',
                                openId:openId
                            },
                            success:function(data){
                                var wechat = eval("("+data+")");
                                if(wechat.returnCode == "200"){
                                    layer.closeAll();
                                    if(wechat.result.realName != ""){
                                        $("#account").text(wechat.result.realName);
                                    }
                                    else if(wechat.result.realName == ""){
                                        $("#account").text("您还未登录哦！");
                                    }
                                    $("#compNickName").text(wechat.result.companyNickName);
                                    $("#deptName").text(wechat.result.departmentName);
                                }
                                else{
                                    layer.closeAll();
                                    $("#account").text("您还未登录哦！");
                                    layer.msg("您未绑定农商号，请登录绑定！",{shadeClose:true,shade:0.1,time:2000});
                                }
                            }
                        })
                    }
                }
            });
        }
        else{}
    });
    
</script>
</html>


